<!-- 
<?php

$f = $_SERVER['HTTP_REFERER'];

if (!empty($f))
{
    
}else{
    echo "<script>location='tijiao.php';</script>";
}
?>

 -->

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/zzsc.css">
<link rel="stylesheet" type="text/css" href="css/ripple.css">
<title>后台控制小车</title>

<style type="text/css">
	.clearfix:after, .container:after, .tab-nav:after {
	  content: ".";
	  display: block;
	  height: 0;
	  clear: both;
	  visibility: hidden;
	}

	/* ==========
	   Setup Page */
	*, *:before, *:after {
	  box-sizing: border-box;
	}

	body {
	  font-family: 'Quicksand', sans-serif;
	}

	/* =================
	   Container Styling */
	.container {
	  position: relative;
	  background: #40404A;
	  padding: 3em;
	}

	/* ===========
	   Tab Styling */
	.tab-group {
	  position: relative;
	  border: 1px solid #eee;
	  margin-top: 2.5em;
	  border-radius: 0 0 10px 10px;
	}
	.tab-group section {
	  opacity: 0;
	  height: 0;
	  padding: 0 1em;
	  overflow: hidden;
	  transition: opacity 0.4s ease, height 0.4s ease;
	}
	.tab-group section.active {
	  opacity: 1;
	  height: auto;
	  overflow: visible;
	}

	.tab-nav {
	  list-style: none;
	  margin: -2.5em -1px 0 0;
	  padding: 0;
	  height: 2.5em;
	  overflow: hidden;
	}
	.tab-nav li {
	  display: inline;
	}
	.tab-nav li a {
	  top: 1px;
	  position: relative;
	  display: block;
	  float: left;
	  border-radius: 10px 10px 0 0;
	  background: #FD9D33;
	  line-height: 2em;
	  padding: 0 1em;
	  text-decoration: none;
	  color: grey;
	  margin-top: .5em;
	  margin-right: 1px;
	  transition: background .2s ease, line-height .2s ease, margin .2s ease;
	}
	.tab-nav li.active a {
	  background: #FB2B1A;
	  color: white;
	  line-height: 2.5em;
	  margin-top: 0;
	}
</style>

<script src="js/prefixfree.min.js"></script>
<h2>后台控制小车</h3>

</head>
<body>
 <form action ="../tunk/index2.php" method="post">
<div class="htmleaf-container">
	<div class="container">
	  <div class="tab-group">
		<section id="tab1" title="方向">
		   <h3>方向</h3>
           
                
                 <input  class="btn btn-default btn-lg ripple" type = "submit" value = "前进" name = "car01_ONA"/>
                 <input  class="btn btn-primary btn-lg ripple" type = "submit" value = "后退" name = "car01_ONB"/>
                 <input  class="btn btn-success btn-lg ripple" type = "submit" value = "左转" name = "car01_ONC"/>
                 <input  class="btn btn-info btn-lg ripple"    type = "submit" value = "右转" name = "car01_OND"/>
                 <input  class="btn btn-warning btn-lg ripple" type = "submit" value = "停止" name = "car01_ONF"/>
				 
                  &nbsp&nbsp&nbsp
 一号小车<input id="dvCBs" type = "checkbox" name = "car[]" value = "'car01'"/>
    <Br/>
    <Br/>
    <input  class="btn btn-default btn-lg ripple" type = "submit" value = "前进" name = "car02_ONA"/>
    <input  class="btn btn-primary btn-lg ripple" type = "submit" value = "后退" name = "car02_ONB"/>
    <input  class="btn btn-success btn-lg ripple" type = "submit" value = "左转" name = "car02_ONC"/>
    <input  class="btn btn-info btn-lg ripple"    type = "submit" value = "右转" name = "car02_OND"/>
    <input  class="btn btn-warning btn-lg ripple" type = "submit" value = "停止" name = "car02_ONF"/>
    &nbsp&nbsp&nbsp
    二号小车<input id="dvCBs" type = "checkbox" name = "car[]" value = "'car02'"/>
    <Br/>
    <Br/>
    <input  class="btn btn-default btn-lg ripple" type = "submit" value = "前进" name = "car03_ONA"/>
    <input  class="btn btn-primary btn-lg ripple" type = "submit" value = "后退" name = "car03_ONB"/>
    <input  class="btn btn-success btn-lg ripple" type = "submit" value = "左转" name = "car03_ONC"/>
    <input  class="btn btn-info btn-lg ripple"    type = "submit" value = "右转" name = "car03_OND"/>
    <input  class="btn btn-warning btn-lg ripple" type = "submit" value = "停止" name = "car03_ONF"/>
    &nbsp&nbsp&nbsp
    三号小车<input id="dvCBs" type = "checkbox" name = "car[]" value = "'car03'"/>
    <Br/>
    <Br/>
    <input  class="btn btn-default btn-lg ripple" type = "submit" value = "前进" name = "car04_ONA"/>
    <input  class="btn btn-primary btn-lg ripple" type = "submit" value = "后退" name = "car04_ONB"/>
    <input  class="btn btn-success btn-lg ripple" type = "submit" value = "左转" name = "car04_ONC"/>
    <input  class="btn btn-info btn-lg ripple"    type = "submit" value = "右转" name = "car04_OND"/>
    <input  class="btn btn-warning btn-lg ripple" type = "submit" value = "停止" name = "car04_ONF"/>
    &nbsp&nbsp&nbsp
    四号小车<input id="dvCBs" type = "checkbox" name = "car[]" value = "'car04'"/>
    <Br/>
    <Br/>
    <input  class="btn btn-default btn-lg ripple" type = "submit" value = "全部前进" name = "car_all_advance"/>
    <input  class="btn btn-primary btn-lg ripple" type = "submit" value = "全部后退" name = "car_all_back"/>
    <input  class="btn btn-success btn-lg ripple" type = "submit" value = "全部左转" name = "car_all_left"/>
    <input  class="btn btn-info btn-lg ripple"    type = "submit" value = "全部右转" name = "car_all_right"/>
    <input  class="btn btn-warning btn-lg ripple" type = "submit" value = "全部停止" name = "car_all_stop"/>
    &nbsp&nbsp
    &nbsp&nbsp  <Br/>
    <Br/>
    
		</section>
		<script>
var dv = document.getElementById('dvCBs'), cbs = dv.getElementsByTagName('input');
dv.onclick = function (e) {
    e = e || window.event;
    var o = e.target || e.srcElement;
    if (o.type == 'checkbox') {
        var vs = '';
        for (var i = 0; i < cbs.length; i++)
            if (cbs[i].checked) vs += ',' + cbs[i].value;
        document.cookie = 'vs=' + vs.substring(1);//存储选中的checkbook的值
    }
}
var m = /(^| |;)vs=([^;]+)/.exec(document.cookie);
if (m) {//cookie中有值，初始化勾选状态
    var arr = m[2].split(',');
    for(var j=0;j<arr.length;j++)
        for(var i=0;i<cbs.length;i++)
            if (cbs[i].value == arr[j]) { cbs[i].checked = true; break;}
}
</script>
		</form>
		<section id="tab2" title="温度">
		  <img src=zhexian1.php>
           <img src=zhexian2.php>
            <img src=zhexian3.php>
             <img src=zhexian4.php>
		</section>
		<section id="tab3" title="照片">
		  
          
		  
		  <form action ="../tunk/index2.php" method="post">
           2号车<input type = "checkbox" name = "car[]" value = "'car02'"/>
            3号车<input type = "checkbox" name = "car[]" value = "'car03'"/>
		   <input   type = "text"  name = "car"/>
           <input  type = "submit" />
           </form>
           <?php
           
           if($_POST['car']=="ONA")
		   {
			    $sql="update test.user set sex='ONA' where name='car01'OR name='car02'OR name='car03'OR name='car04'";
    if (mysql_query($sql)) echo '选中小车成功前进';
    else echo "error".mysql_error();
			   }
		   
		   ?>
		  
          
		</section>
		
	  </div>
	</div>
</div>

<script src="js/jquery-1.11.0.min.js" type="text/javascript"></script>
<script type="text/javascript" src="js/jquery-tab.js"></script>
<script type="text/javascript">
	$(function(){
		// Calling the plugin
		$('.tab-group').tabify();
	})
</script>

<div style="text-align:center;clear:both;margin-top:80px">
<script src="/gg_bd_ad_720x90.js" type="text/javascript"></script>
<script src="/follow.js" type="text/javascript"></script>
</div>

<?php
error_reporting(E_ALL &~E_NOTICE &~E_DEPRECATED &~E_WARNING);
mysql_query("SET NAMES 'gb2312'");

$host = '127.0.0.1';
$username = 'vinc';
$password = '';
$conn = mysql_connect($host,$username,$password);
if(isset($_POST['car01_ONA'])){
    $sql="update test.user set sex='ONA' where name='car01'";
    if (mysql_query($sql)) echo '一号小车成功前进';
    else echo "yihaox".mysql_error();
} else if (isset($_POST['car01_ONB'])){
    $sql="update test.user set sex='ONB' where name='car01'";
    if (mysql_query($sql)) echo '一号小车成功后退';
    else echo "fal，SQL:".mysql_error();
} else if (isset($_POST['car01_ONC'])){
    $sql="update test.user set sex='ONC' where name='car01'";
    if (mysql_query($sql)) echo '一号小车成功左转';
    else echo "fal，SQL:".mysql_error();
} else if (isset($_POST['car01_OND'])){
    $sql="update test.user set sex='OND' where name='car01'";
    if (mysql_query($sql)) echo '一号小车成功右转';
    else echo "fal，SQL:".mysql_error();
} else if (isset($_POST['car01_ONF'])){
    $sql="update test.user set sex='ONF' where name='car01'";
    if (mysql_query($sql)) echo '一号小车成功停止';
    else echo "fal，SQL:".mysql_error();
} else if (isset($_POST['car02_ONA'])){
    $sql="update test.user set sex='ONA' where name='car02'";
    if (mysql_query($sql)) echo '二号小车成功前进';
    else echo "fal，SQL:".mysql_error();
} else if (isset($_POST['car02_ONB'])){
    $sql="update test.user set sex='ONB' where name='car02'";
    if (mysql_query($sql)) echo '二号小车成功后退';
    else echo "fal，SQL:".mysql_error();
} else if (isset($_POST['car02_ONC'])){
    $sql="update test.user set sex='ONC' where name='car02'";
    if (mysql_query($sql)) echo '二号小车成功左转';
    else echo "fal，SQL:".mysql_error();
} else if (isset($_POST['car02_OND'])){
    $sql="update test.user set sex='OND' where name='car02'";
    if (mysql_query($sql)) echo '二号小车成功右转';
    else echo "fal，SQL:".mysql_error();
} else if (isset($_POST['car02_ONF'])){
    $sql="update test.user set sex='ONF' where name='car02'";
    if (mysql_query($sql)) echo '二号小车成功停止';
    else echo "fal，SQL:".mysql_error();
} else if (isset($_POST['car03_ONA'])){
    $sql="update test.user set sex='ONA' where name='car03'";
    if (mysql_query($sql)) echo '三号小车成功前进';
    else echo "fal，SQL:".mysql_error();
} else if (isset($_POST['car03_ONB'])){
    $sql="update test.user set sex='ONB' where name='car03'";
    if (mysql_query($sql)) echo '三号小车成功后退';
    else echo "fal，SQL:".mysql_error();
} else if (isset($_POST['car03_ONC'])){
    $sql="update test.user set sex='ONC' where name='car03'";
    if (mysql_query($sql)) echo '三号小车成功左转';
    else echo "fal，SQL:".mysql_error();
} else if (isset($_POST['car03_OND'])){
    $sql="update test.user set sex='OND' where name='car03'";
    if (mysql_query($sql)) echo '三号小车成功右转';
    else echo "fal，SQL:".mysql_error();
} else if (isset($_POST['car03_ONF'])){
    $sql="update test.user set sex='ONF' where name='car03'";
    if (mysql_query($sql)) echo '三号小车成功停止';
    else echo "fal，SQL:".mysql_error();
} else if (isset($_POST['car04_ONA'])){
    $sql="update test.user set sex='ONA' where name='car04'";
    if (mysql_query($sql)) echo '四号小车成功前进';
    else echo "fal，SQL:".mysql_error();
} else if (isset($_POST['car04_ONB'])){
    $sql="update test.user set sex='ONB' where name='car04'";
    if (mysql_query($sql)) echo '四号小车成功后退';
    else echo "fal，SQL:".mysql_error();
} else if (isset($_POST['car04_ONC'])){
    $sql="update test.user set sex='ONC' where name='car04'";
    if (mysql_query($sql)) echo '四号小车成功左转';
    else echo "fal，SQL:".mysql_error();
} else if (isset($_POST['car04_OND'])){
    $sql="update test.user set sex='OND' where name='car04'";
    if (mysql_query($sql)) echo '四号小车成功右转';
    else echo "fal，SQL:".mysql_error();
} else if (isset($_POST['car04_ONF'])){
    $sql="update test.user set sex='ONF' where name='car04'";
    if (mysql_query($sql)) echo '四号小车成功停止';
    else echo "fal，SQL:".mysql_error();
} else if (isset($_POST['car_all_stop'])){
    $sql="update test.user set sex='ONF' where name='car01'OR name='car02'OR name='car03'OR name='car04'";
    if (mysql_query($sql)) echo '选中小车成功停止';
    else echo "fal，SQL:".mysql_error();
} else if (isset($_POST['car_all_advance'])){
    $sql="update test.user set sex='ONA' where name='car01'OR name='car02'OR name='car03'OR name='car04'";
    if (mysql_query($sql)) echo '选中小车成功前进';
    else echo "fal，SQL:".mysql_error();
} else if (isset($_POST['car_all_back'])){
    $sql="update test.user set sex='ONB' where name='car01'OR name='car02'OR name='car03'OR name='car04'";
    if (mysql_query($sql)) echo '选中小车成功后退';
    else echo "fal，SQL:".mysql_error();
} else if (isset($_POST['car_all_left'])){
    $sql="update test.user set sex='ONC' where name='car01'OR name='car02'OR name='car03'OR name='car04'";
    if (mysql_query($sql)) echo '选中小车成功左转';
    else echo "fal，SQL:".mysql_error();
}else if (isset($_POST['car_all_right'])){
    $sql="update test.user set sex='OND' where name='car01'OR name='car02'OR name='car03'OR name='car04'";
    if (mysql_query($sql)) echo '选中小车成功右转';
    else echo "fal，SQL:".mysql_error();
}
mysql_close();

?>
